import request from "@/utils/request"

const commonPath = "/admin/product/baseTrademark";
const tradeMark = {
  //分页获取品牌列表  page:当前显示第几页   limit:每页显示多少条
  getBaseTradeMark:function ({page,limit}){
    return request.get(`${commonPath}/${page}/${limit}`)
  },

  //新增品牌(带token)
  addBaseTradeMark:function ({logoUrl,tmName}){
    return request.post(`${commonPath}/save`,{ logoUrl,tmName })
  },

  //修改品牌(带token)
  updateBaseTradeMark:function ({id,logoUrl,tmName}){
    return request.put(`${commonPath}/update`,{id, logoUrl,tmName })
  },

  //新增品牌 或 修改品牌(带token)
  addOrUpdateTradeMark({id,logoUrl,tmName}){
    if(id)
      return tradeMark.updateBaseTradeMark({id,logoUrl,tmName})
    else
      return tradeMark.addBaseTradeMark({id,logoUrl,tmName})

  },

  //删除品牌(带token)
  deleteTradeMark(id){
    return request.delete(`${commonPath}/remove/${id}`)
  }
}

export default tradeMark
